package com.ads.tpgrupo4.server.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.joda.time.DateTime;

public class DateUtils {

	public static Date fromDDMMYYYY(final String dateValue) throws ParseException {
		
		return new SimpleDateFormat("dd-MM-yyyy").parse(dateValue);
	}
	
	public static String toXmlDateTimeString(final Date date) {

		final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-d'T'HH:mm:ss.S");
		
		return df.format(date);
	}
	
	public static Date plusDays(final Date date, int days) {
		
		final DateTime dateTime = new DateTime(date).plusDays(days);

		return dateTime.toDate();
	}
	
	public static Date now() {
		return new Date();
	}
	
}
